/***********************************************************************************/
/* Code license:  GNU General Public License v3                                    */
/* Main page:     https://code.google.com/p/library-cross-platform/                */
/* Issue tracker: https://code.google.com/p/library-cross-platform/issues/list     */
/***********************************************************************************/

#include <regex.h>
#include "rexp.h"
#include "types.h"

namespace r_exp {

bool match(const char *in_string, const char *pattern)
{
  int     status;
  regex_t re;

  if (regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB) != 0) {
    return false; /* Report error. */
  }
  status = regexec(&re, in_string, (size_t) 0, null, 0);
  regfree(&re);
  if (status != 0) {
    return false;      /* Report error. */
  }
  return true;
}

/********************************************************************************************
To build like std::tr1::regex rx(...) requires compiler and library support for
upcomming ISO C++ stansars, c++0x
*********************************************************************************************/

}
